1 + 100
2^2
7/2
4-1
2*2
3 + 5*2
(3+5)*2
2e2
2/100000
sin(1)
log(1)
exp(0)
1 == 1
1 >= 1
1 < 1
1 != 2
x <- 10
x <- 10
x
x + x
x - 5
x^2
y <- x + x
y
1:5
2^(1:5)
v <- 1:5
2^v
log10(v)
installed.packages()
Package LibPath
askpass "askpass" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
base "base" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
base64enc "base64enc" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
boot "boot" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
bslib "bslib" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
cachem "cachem" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
class "class" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
cluster "cluster" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
codetools "codetools" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
compiler "compiler" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
curl "curl" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
datasets "datasets" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
digest "digest" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
evaluate "evaluate" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
fastmap "fastmap" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
foreign "foreign" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
fs "fs" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
glue "glue" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
graphics "graphics" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
grDevices "grDevices" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
grid "grid" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
highr "highr" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
htmltools "htmltools" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
jquerylib "jquerylib" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
jsonlite "jsonlite" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
KernSmooth "KernSmooth" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
knitr "knitr" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
lattice "lattice" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
magrittr "magrittr" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
markdown "markdown" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
MASS "MASS" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
Matrix "Matrix" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
memoise "memoise" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
methods "methods" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
mgcv "mgcv" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
mime "mime" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
nlme "nlme" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
nnet "nnet" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
openssl "openssl" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
packrat "packrat" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
parallel "parallel" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
permute "permute" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
R6 "R6" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rappdirs "rappdirs" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rlang "rlang" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rmarkdown "rmarkdown" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rpart "rpart" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rsconnect "rsconnect" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
rstudioapi "rstudioapi" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
sass "sass" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
spatial "spatial" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
splines "splines" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
stats "stats" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
stats4 "stats4" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
stringi "stringi" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
stringr "stringr" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
survival "survival" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
sys "sys" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
tcltk "tcltk" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
tinytex "tinytex" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
tools "tools" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
utils "utils" "/Library/Frameworks/R.framework/Versions/4.2/Resources/library"
Version Priority Depends
askpass "1.1" NA NA
base "4.2.1" "base" NA
base64enc "0.1-3" NA "R (>= 2.9.0)"
boot "1.3-28" "recommended" "R (>= 3.0.0), graphics, stats"
bslib "0.4.0" NA "R (>= 2.10)"
cachem "1.0.6" NA NA
class "7.3-20" "recommended" "R (>= 3.0.0), stats, utils"
cluster "2.1.3" "recommended" "R (>= 3.5.0)"
codetools "0.2-18" "recommended" "R (>= 2.1)"
compiler "4.2.1" "base" NA
curl "4.3.2" NA "R (>= 3.0.0)"
datasets "4.2.1" "base" NA
digest "0.6.29" NA "R (>= 3.3.0)"
evaluate "0.16" NA "R (>= 3.0.2)"
fastmap "1.1.0" NA NA
foreign "0.8-82" "recommended" "R (>= 4.0.0)"
fs "1.5.2" NA "R (>= 3.1)"
glue "1.6.2" NA "R (>= 3.4)"
graphics "4.2.1" "base" NA
grDevices "4.2.1" "base" NA
grid "4.2.1" "base" NA
highr "0.9" NA "R (>= 3.2.3)"
htmltools "0.5.3" NA "R (>= 2.14.1)"
jquerylib "0.1.4" NA NA
jsonlite "1.8.0" NA "methods"
KernSmooth "2.23-20" "recommended" "R (>= 2.5.0), stats"
knitr "1.40" NA "R (>= 3.3.0)"
lattice "0.20-45" "recommended" "R (>= 3.0.0)"
magrittr "2.0.3" NA "R (>= 3.4.0)"
markdown "1.1" NA "R (>= 2.11.1)"
MASS "7.3-57" "recommended" "R (>= 3.3.0), grDevices, graphics, stats, utils"
Matrix "1.4-1" "recommended" "R (>= 3.5.0)"
memoise "2.0.1" NA NA
methods "4.2.1" "base" NA
mgcv "1.8-40" "recommended" "R (>= 3.6.0), nlme (>= 3.1-64)"
mime "0.12" NA NA
nlme "3.1-157" "recommended" "R (>= 3.5.0)"
nnet "7.3-17" "recommended" "R (>= 3.0.0), stats, utils"
openssl "2.0.3" NA NA
packrat "0.8.1" NA "R (>= 3.0.0)"
parallel "4.2.1" "base" NA
permute "0.9-7" NA "R (>= 2.14.0)"
R6 "2.5.1" NA "R (>= 3.0)"
rappdirs "0.3.3" NA "R (>= 3.2)"
rlang "1.0.6" NA "R (>= 3.4.0)"
rmarkdown "2.16" NA "R (>= 3.0)"
rpart "4.1.16" "recommended" "R (>= 2.15.0), graphics, stats, grDevices"
rsconnect "0.8.27" NA "R (>= 3.0.0)"
rstudioapi "0.14" NA NA
sass "0.4.2" NA NA
spatial "7.3-15" "recommended" "R (>= 3.0.0), graphics, stats, utils"
splines "4.2.1" "base" NA
stats "4.2.1" "base" NA
stats4 "4.2.1" "base" NA
stringi "1.7.8" NA "R (>= 3.1)"
stringr "1.4.1" NA "R (>= 3.1)"
survival "3.3-1" "recommended" "R (>= 3.5.0)"
sys "3.4" NA NA
tcltk "4.2.1" "base" NA
tinytex "0.42" NA NA
tools "4.2.1" "base" NA
utils "4.2.1" "base" NA
Imports
askpass "sys (>= 2.1)"
base NA
base64enc NA
boot NA
bslib "grDevices, htmltools (>= 0.5.2), jsonlite, sass (>= 0.4.0),\njquerylib (>= 0.1.3), rlang, cachem, memoise"
cachem "rlang, fastmap"
class "MASS"
cluster "graphics, grDevices, stats, utils"
codetools NA
compiler NA
curl NA
datasets NA
digest "utils"
evaluate "methods"
fastmap NA
foreign "methods, utils, stats"
fs "methods"
glue "methods"
graphics "grDevices"
grDevices NA
grid "grDevices, utils"
highr "xfun (>= 0.18)"
htmltools "utils, digest, grDevices, base64enc, rlang (>= 0.4.10),\nfastmap (>= 1.1.0)"
jquerylib "htmltools"
jsonlite NA
KernSmooth NA
knitr "evaluate (>= 0.15), highr, methods, stringr (>= 0.6), yaml (>=\n2.1.19), xfun (>= 0.29), tools"
lattice "grid, grDevices, graphics, stats, utils"
magrittr NA
markdown "utils, xfun, mime (>= 0.3)"
MASS "methods"
Matrix "methods, graphics, grid, stats, utils, lattice"
memoise "rlang (>= 0.4.10), cachem"
methods "utils, stats"
mgcv "methods, stats, graphics, Matrix, splines, utils"
mime "tools"
nlme "graphics, stats, utils, lattice"
nnet NA
openssl "askpass"
packrat "tools, utils"
parallel "tools, compiler"
permute "stats"
R6 NA
rappdirs NA
rlang "utils"
rmarkdown "bslib (>= 0.2.5.1), evaluate (>= 0.13), htmltools (>= 0.5.1),\njquerylib, jsonlite, knitr (>= 1.22), methods, stringr (>=\n1.2.0), tinytex (>= 0.31), tools, utils, xfun (>= 0.30), yaml\n(>= 2.1.19)"
rpart NA
rsconnect "curl, digest, jsonlite, openssl (>= 2.0.0), packrat (>= 0.6),\nrstudioapi (>= 0.5), tools, yaml (>= 2.1.5)"
rstudioapi NA
sass "fs, rlang (>= 0.4.10), htmltools (>= 0.5.1), R6, rappdirs"
spatial NA
splines "graphics, stats"
stats "utils, grDevices, graphics"
stats4 "graphics, methods, stats"
stringi "tools, utils, stats"
stringr "glue (>= 1.2.0), magrittr, stringi (>= 1.1.7)"
survival "graphics, Matrix, methods, splines, stats, utils"
sys NA
tcltk "utils"
tinytex "xfun (>= 0.29)"
tools NA
utils NA
LinkingTo
askpass NA
base NA
base64enc NA
boot NA
bslib NA
cachem NA
class NA
cluster NA
codetools NA
compiler NA
curl NA
datasets NA
digest NA
evaluate NA
fastmap NA
foreign NA
fs NA
glue NA
graphics NA
grDevices NA
grid NA
highr NA
htmltools NA
jquerylib NA
jsonlite NA
KernSmooth NA
knitr NA
lattice NA
magrittr NA
markdown NA
MASS NA
Matrix NA
memoise NA
methods NA
mgcv NA
mime NA
nlme NA
nnet NA
openssl NA
packrat NA
parallel NA
permute NA
R6 NA
rappdirs NA
rlang NA
rmarkdown NA
rpart NA
rsconnect NA
rstudioapi NA
sass NA
spatial NA
splines NA
stats NA
stats4 NA
stringi NA
stringr NA
survival NA
sys NA
tcltk NA
tinytex NA
tools NA
utils NA
Suggests
askpass "testthat"
base "methods"
base64enc NA
boot "MASS, survival"
bslib "shiny (>= 1.6.0), rmarkdown (>= 2.7), thematic, knitr,\ntestthat, withr, rappdirs, curl, magrittr"
cachem "testthat"
class NA
cluster "MASS, Matrix"
codetools NA
compiler NA
curl "spelling, testthat (>= 1.0.0), knitr, jsonlite, rmarkdown,\nmagrittr, httpuv (>= 1.4.4), webutils"
datasets NA
digest "tinytest, simplermarkdown"
evaluate "covr, ggplot2, lattice, testthat"
fastmap "testthat (>= 2.1.1)"
foreign NA
fs "testthat, covr, pillar (>= 1.0.0), tibble (>= 1.1.0), crayon,\nrmarkdown, knitr, withr, spelling, vctrs (>= 0.3.0)"
glue "covr, crayon, DBI, dplyr, forcats, ggplot2, knitr, magrittr,\nmicrobenchmark, R.utils, rmarkdown, rprintf, RSQLite, stringr,\ntestthat (>= 3.0.0), vctrs (>= 0.3.0), waldo (>= 0.3.0), withr"
graphics NA
grDevices "KernSmooth"
grid NA
highr "knitr, markdown, testit"
htmltools "markdown, testthat, withr, Cairo, ragg, shiny"
jquerylib "testthat"
jsonlite "httr, curl, vctrs, testthat, knitr, rmarkdown, R.rsp, sf"
KernSmooth "MASS, carData"
knitr "markdown, formatR, testit, digest, rgl (>= 0.95.1201),\ncodetools, rmarkdown, htmlwidgets (>= 0.7), webshot, tikzDevice\n(>= 0.10), tinytex, reticulate (>= 1.4), JuliaCall (>= 0.11.1),\nmagick, png, jpeg, gifski, xml2 (>= 1.2.0), httr, DBI (>=\n0.4-1), showtext, tibble, sass, bslib, ragg, gridSVG, styler\n(>= 1.2.0), targets (>= 0.6.0)"
lattice "KernSmooth, MASS, latticeExtra"
magrittr "covr, knitr, rlang, rmarkdown, testthat"
markdown "knitr, RCurl"
MASS "lattice, nlme, nnet, survival"
Matrix "expm, MASS"
memoise "digest, aws.s3, covr, googleAuthR, googleCloudStorageR, httr,\ntestthat"
methods "codetools"
mgcv "parallel, survival, MASS"
mime NA
nlme "Hmisc, MASS, SASmixed"
nnet "MASS"
openssl "curl, testthat (>= 2.1.0), digest, knitr, rmarkdown,\njsonlite, jose, sodium"
packrat "testthat (>= 3.0.0), devtools, httr, knitr, rmarkdown"
parallel "methods"
permute "vegan (>= 2.0-0), testthat (>= 0.5), parallel, knitr,\nrmarkdown, bookdown, sessioninfo"
R6 "testthat, pryr"
rappdirs "roxygen2, testthat (>= 3.0.0), covr, withr"
rlang "cli (>= 3.1.0), covr, crayon, fs, glue, knitr, magrittr,\nmethods, pillar, rmarkdown, stats, testthat (>= 3.0.0), tibble,\nusethis, vctrs (>= 0.2.3), withr"
rmarkdown "digest, dygraphs, fs, rsconnect, downlit (>= 0.4.0), katex\n(>= 1.4.0), sass (>= 0.4.0), shiny (>= 1.6.0), testthat (>=\n3.0.3), tibble, tufte, vctrs, withr (>= 2.4.2)"
rpart "survival"
rsconnect "MASS, RCurl, callr, httpuv, knitr, plumber (>= 0.3.2),\nreticulate, rmarkdown (>= 1.1), shiny, sourcetools, testthat,\nxtable"
rstudioapi "testthat, knitr, rmarkdown, clipr, covr"
sass "testthat, knitr, rmarkdown, withr, shiny, curl"
spatial "MASS"
splines "Matrix, methods"
stats "MASS, Matrix, SuppDists, methods, stats4"
stats4 NA
stringi NA
stringr "covr, htmltools, htmlwidgets, knitr, rmarkdown, testthat"
survival NA
sys "unix (>= 1.4), spelling, testthat"
tcltk NA
tinytex "testit, rstudioapi"
tools "codetools, methods, xml2, curl, commonmark, knitr, xfun, mathjaxr"
utils "methods, xml2, commonmark, knitr"
Enhances
askpass NA
base NA
base64enc "png"
boot NA
bslib NA
cachem NA
class NA
cluster NA
codetools NA
compiler NA
curl NA
datasets NA
digest NA
evaluate NA
fastmap NA
foreign NA
fs NA
glue NA
graphics NA
grDevices NA
grid NA
highr NA
htmltools "knitr"
jquerylib NA
jsonlite NA
KernSmooth NA
knitr NA
lattice "chron"
magrittr NA
markdown NA
MASS NA
Matrix "MatrixModels, graph, SparseM, sfsmisc, igraph, maptools, sp,\nspdep"
memoise NA
methods NA
mgcv NA
mime NA
nlme NA
nnet NA
openssl NA
packrat NA
parallel "snow, nws, Rmpi"
permute NA
R6 NA
rappdirs NA
rlang "winch"
rmarkdown NA
rpart NA
rsconnect NA
rstudioapi NA
sass NA
spatial NA
splines NA
stats NA
stats4 NA
stringi NA
stringr NA
survival NA
sys NA
tcltk NA
tinytex NA
tools NA
utils NA
License License_is_FOSS License_restricts_use OS_type
askpass "MIT + file LICENSE" NA NA NA
base "Part of R 4.2.1" NA NA NA
base64enc "GPL-2 | GPL-3" NA NA NA
boot "Unlimited" NA NA NA
bslib "MIT + file LICENSE" NA NA NA
cachem "MIT + file LICENSE" NA NA NA
class "GPL-2 | GPL-3" NA NA NA
cluster "GPL (>= 2)" NA NA NA
codetools "GPL" NA NA NA
compiler "Part of R 4.2.1" NA NA NA
curl "MIT + file LICENSE" NA NA NA
datasets "Part of R 4.2.1" NA NA NA
digest "GPL (>= 2)" NA NA NA
evaluate "MIT + file LICENSE" NA NA NA
fastmap "MIT + file LICENSE" NA NA NA
foreign "GPL (>= 2)" NA NA NA
fs "MIT + file LICENSE" NA NA NA
glue "MIT + file LICENSE" NA NA NA
graphics "Part of R 4.2.1" NA NA NA
grDevices "Part of R 4.2.1" NA NA NA
grid "Part of R 4.2.1" NA NA NA
highr "GPL" NA NA NA
htmltools "GPL (>= 2)" NA NA NA
jquerylib "MIT + file LICENSE" NA NA NA
jsonlite "MIT + file LICENSE" NA NA NA
KernSmooth "Unlimited" NA NA NA
knitr "GPL" NA NA NA
lattice "GPL (>= 2)" NA NA NA
magrittr "MIT + file LICENSE" NA NA NA
markdown "GPL-2" NA NA NA
MASS "GPL-2 | GPL-3" NA NA NA
Matrix "GPL (>= 2) | file LICENCE" NA NA NA
memoise "MIT + file LICENSE" NA NA NA
methods "Part of R 4.2.1" NA NA NA
mgcv "GPL (>= 2)" NA NA NA
mime "GPL" NA NA NA
nlme "GPL (>= 2)" NA NA NA
nnet "GPL-2 | GPL-3" NA NA NA
openssl "MIT + file LICENSE" NA NA NA
packrat "GPL-2" NA NA NA
parallel "Part of R 4.2.1" NA NA NA
permute "GPL-2" NA NA NA
R6 "MIT + file LICENSE" NA NA NA
rappdirs "MIT + file LICENSE" NA NA NA
rlang "MIT + file LICENSE" NA NA NA
rmarkdown "GPL-3" NA NA NA
rpart "GPL-2 | GPL-3" NA NA NA
rsconnect "GPL-2" NA NA NA
rstudioapi "MIT + file LICENSE" NA NA NA
sass "MIT + file LICENSE" NA NA NA
spatial "GPL-2 | GPL-3" NA NA NA
splines "Part of R 4.2.1" NA NA NA
stats "Part of R 4.2.1" NA NA NA
stats4 "Part of R 4.2.1" NA NA NA
stringi "file LICENSE" NA NA NA
stringr "GPL-2 | file LICENSE" NA NA NA
survival "LGPL (>= 2)" NA NA NA
sys "MIT + file LICENSE" NA NA NA
tcltk "Part of R 4.2.1" NA NA NA
tinytex "MIT + file LICENSE" NA NA NA
tools "Part of R 4.2.1" NA NA NA
utils "Part of R 4.2.1" NA NA NA
MD5sum NeedsCompilation Built
askpass NA "yes" "4.2.0"
base NA NA "4.2.1"
base64enc NA "yes" "4.2.0"
boot NA "no" "4.2.1"
bslib NA "no" "4.2.0"
cachem NA "yes" "4.2.0"
class NA "yes" "4.2.1"
cluster NA "yes" "4.2.1"
codetools NA "no" "4.2.1"
compiler NA NA "4.2.1"
curl NA "yes" "4.2.0"
datasets NA NA "4.2.1"
digest NA "yes" "4.2.0"
evaluate NA "no" "4.2.0"
fastmap NA "yes" "4.2.0"
foreign NA "yes" "4.2.1"
fs NA "yes" "4.2.0"
glue NA "yes" "4.2.0"
graphics NA "yes" "4.2.1"
grDevices NA "yes" "4.2.1"
grid NA "yes" "4.2.1"
highr NA "no" "4.2.0"
htmltools NA "yes" "4.2.0"
jquerylib NA "no" "4.2.0"
jsonlite NA "yes" "4.2.0"
KernSmooth NA "yes" "4.2.1"
knitr NA "no" "4.2.0"
lattice NA "yes" "4.2.1"
magrittr NA "yes" "4.2.0"
markdown NA "yes" "4.2.0"
MASS NA "yes" "4.2.1"
Matrix NA "yes" "4.2.1"
memoise NA "no" "4.2.0"
methods NA "yes" "4.2.1"
mgcv NA "yes" "4.2.1"
mime NA "yes" "4.2.0"
nlme NA "yes" "4.2.1"
nnet NA "yes" "4.2.1"
openssl NA "yes" "4.2.0"
packrat NA "no" "4.2.1"
parallel NA "yes" "4.2.1"
permute NA "no" "4.2.0"
R6 NA "no" "4.2.0"
rappdirs NA "yes" "4.2.0"
rlang NA "yes" "4.2.0"
rmarkdown NA "no" "4.2.1"
rpart NA "yes" "4.2.1"
rsconnect NA "no" "4.2.1"
rstudioapi NA "no" "4.2.0"
sass NA "yes" "4.2.0"
spatial NA "yes" "4.2.1"
splines NA "yes" "4.2.1"
stats NA "yes" "4.2.1"
stats4 NA NA "4.2.1"
stringi NA "yes" "4.2.0"
stringr NA "no" "4.2.0"
survival NA "yes" "4.2.1"
sys NA "yes" "4.2.0"
tcltk NA "yes" "4.2.1"
tinytex NA "no" "4.2.0"
tools NA "yes" "4.2.1"
utils NA "yes" "4.2.1"
[ reached getOption("max.print") -- omitted 2 rows ]
#install.packages("vegan", dependencies = TRUE)
#library(vegan)
#remove.packages("vegan")
?plot()
help(plot)
?"<-"
vignette("FAQ-vegan")
Warning: vignette ‘FAQ-vegan’ not found
cats <- data.frame(coat = c("calico", "black", "taffy"),
weight = c(2.1,5,3.2),
likes_string = c(1,0,1))
cats
getwd()
[1] "/Users/josh/Desktop/BIOL PRACTICAL COMPUTING/pratcomp_2022"
write.csv(cats, file = "./cats.csv")
cats <- read.csv("./data/cats/csv")
Warning: cannot open file './data/cats/csv': No such file or directoryError in file(file, "rt") : cannot open the connection
cats$coat
[1] "calico" "black" "taffy"
cats$weight
[1] 2.1 5.0 3.2
cats$weight*10
[1] 21 50 32
log(cats$weight)
[1] 0.7419373 1.6094379 1.1631508
logweight <- log(cats$weight)
cbind(cats,logweight)
cats <- cbind(cats,logweight)
cats
paste("My cat is ", cats$coat, ", and it weighs ", cats$weight, " kg.", sep="")
[1] "My cat is calico, and it weighs 2.1 kg." "My cat is black, and it weighs 5 kg."
[3] "My cat is taffy, and it weighs 3.2 kg."
typeof(cats$coat)
[1] "character"
typeof(cats$weight)
[1] "double"
typeof(cats$likes_string)
[1] "double"
typeof(3.14159)
[1] "double"
typeof(FALSE)
[1] "logical"
typeof(TRUE)
[1] "logical"
typeof(T)
[1] "logical"
typeof(F)
[1] "logical"
typeof(cats)
[1] "list"
class(cats)
[1] "data.frame"
file.show("./data/cats.csv")
Error: File ./data/cats.csv does not exist.
cats$likes_string <- as.logical(cats$likes_string)
cats$likes_string
[1] TRUE FALSE TRUE
c("a","b")
[1] "a" "b"
ab <- c("a", "b")
ab
[1] "a" "b"
c(ab,"c")
[1] "a" "b" "c"
c(ab, ab)
[1] "a" "b" "a" "b"
1:10
[1] 1 2 3 4 5 6 7 8 9 10
seq(10)
[1] 1 2 3 4 5 6 7 8 9 10
z <- seq(10)
head(z, n=3)
[1] 1 2 3
length(z)
[1] 10
class(z)
[1] "integer"
typeof(z)
[1] "integer"
seq(0,100, by=5)
[1] 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100
cats
str(cats$coat)
chr [1:3] "calico" "black" "taffy"
coats <- c("tabby", "tortoiseshell", "tortoiseshell", "black", "tabby")
coats
[1] "tabby" "tortoiseshell" "tortoiseshell" "black" "tabby"
str(coats)
chr [1:5] "tabby" "tortoiseshell" "tortoiseshell" "black" "tabby"
factor(coats)
[1] tabby tortoiseshell tortoiseshell black tabby
Levels: black tabby tortoiseshell
categories <- factor(coats)
class(coats)
[1] "character"
class(categories)
[1] "factor"
str(categories)
Factor w/ 3 levels "black","tabby",..: 2 3 3 1 2
list_example <- list(title="Numbers", numbers = 1:10, data=TRUE)
list_example
$title
[1] "Numbers"
$numbers
[1] 1 2 3 4 5 6 7 8 9 10
$data
[1] TRUE
another_list <- list(1, "a",TRUE, 1+1i)
another_list
[[1]]
[1] 1
[[2]]
[1] "a"
[[3]]
[1] TRUE
[[4]]
[1] 1+1i
typeof(list_example)
[1] "list"
class(list_example)
[1] "list"
typeof(cats)
[1] "list"
class(cats)
[1] "data.frame"
data.frame(list_example)
cats
cats[,2]
[1] 2.1 5.0 3.2
cats[3,]
cats[2:3,c(1,3)]
matrix_example <- matrix(0, ncol=5, nrow=3)
matrix_example
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 0 0 0 0
[3,] 0 0 0 0 0
class(matrix_example)
[1] "matrix" "array"
typeof(matrix_example)
[1] "double"
str(matrix_example)
num [1:3, 1:5] 0 0 0 0 0 0 0 0 0 0 ...
dim(matrix_example)
[1] 3 5
ncol(matrix_example)
[1] 5
nrow(matrix_example)
[1] 3
class(data.frame(matrix_example))
[1] "data.frame"
df_example <- data.frame(matrix_example)
df_example
p <- c(2.3,6.9,4.0,24.3,2)
p
[1] 2.3 6.9 4.0 24.3 2.0
names(p) <- c('a','b','c','d','e')
p
a b c d e
2.3 6.9 4.0 24.3 2.0
p[2:4]
b c d
6.9 4.0 24.3
p[c(1,5)]
a e
2.3 2.0
p[c(1,1,1,3,5,5)]
a a a c e e
2.3 2.3 2.3 4.0 2.0 2.0
p[6]
<NA>
NA
p[-3]
a b d e
2.3 6.9 24.3 2.0
p[c(-1,-5)]
b c d
6.9 4.0 24.3
p[-(2:4)]
a e
2.3 2.0
p[c('a','c')]
a c
2.3 4.0
p[c(T,F,T,F,T)]
a c e
2.3 4.0 2.0
p[names(p) != 'c']
a b d e
2.3 6.9 24.3 2.0
f <- factor(c('a','b','c','d','e'))
f
[1] a b c d e
Levels: a b c d e
f[f == 'a']
[1] a
Levels: a b c d e
f[1:3]
[1] a b c
Levels: a b c d e
f[f %in% c('b','c')]
[1] b c
Levels: a b c d e
f[-3]
[1] a b d e
Levels: a b c d e
f2 <- c('a','a','b','c','c')
f2
[1] "a" "a" "b" "c" "c"
f2[f2 == 'a']
[1] "a" "a"
f2[f2 %in% c('a','c')]
[1] "a" "a" "c" "c"
set.seed(21)
m <- matrix(rnorm(6*4), ncol=4, nrow=6)
m
[,1] [,2] [,3] [,4]
[1,] 0.7930132 -1.570199630 -0.5484056 -0.78464137
[2,] 0.5222513 -0.934905667 0.1725495 -0.42569229
[3,] 1.7462222 0.063493345 0.5628531 0.39299759
[4,] -1.2713361 -0.002393336 1.5118180 0.03675713
[5,] 2.1973895 -2.276781240 0.6590252 -1.03208366
[6,] 0.4331308 0.757412225 1.1220281 -1.26486147
m[3:4, c(3,1)]
[,1] [,2]
[1,] 0.5628531 1.746222
[2,] 1.5118180 -1.271336
m[,c(3,4)]
[,1] [,2]
[1,] -0.5484056 -0.78464137
[2,] 0.1725495 -0.42569229
[3,] 0.5628531 0.39299759
[4,] 1.5118180 0.03675713
[5,] 0.6590252 -1.03208366
[6,] 1.1220281 -1.26486147
xlist <- list(a="BIOL48006220",b=seq(1,10,by = 0.5), data="Grade")
xlist
$a
[1] "BIOL48006220"
$b
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
$data
[1] "Grade"
xlist[1:2]
$a
[1] "BIOL48006220"
$b
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
xlist['a']
$a
[1] "BIOL48006220"
xlist[['a']]
[1] "BIOL48006220"
xlist['b']
$b
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
xlist[['b']]
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
xlist$b
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0
gp <- read.csv('forest_area_sq_km.csv')
head(gp, n=10L)
head(gp[3], n=10L)
nrow(gp)
[1] 214
head(gp[["country"]], 10L)
[1] "Aruba" "Afghanistan" "Angola"
[4] "Albania" "Andorra" "United Arab Emirates"
[7] "Argentina" "Armenia" "American Samoa"
[10] "Antigua and Barbuda"
gp$X2001
[1] "4.2" "12.1k" "766k" "7720" "160" "3110" "327k" "3320" "177" "93.2"
[11] "1.31M" "38.4k" "9960" "1940" "6720" "40.4k" "71.2k" "19.1k" "34.5k" "4"
[21] "5100" "21.1k" "83.4k" "14.5k" "10" "547k" "5.43M" "63" "3940" "26.3k"
[31] "174k" "228k" "3.48M" "8.68" "12k" "160k" "1.82M" "48.7k" "215k" "1.43M"
[41] "222k" "623k" "408" "403" "28.6k" "25.3k" "129" "1720" "26.4k" "114k"
[51] "56" "479" "5750" "19.9k" "16.5k" "136k" "605" "11.1k" "174k" "22.6k"
[61] "184k" "224k" "10.2k" "155k" "0.8" "639" "237k" "34.6" "29.8k" "27.7k"
[71] "86.7k" "0" "68.6k" "3460" "21.3k" "26k" "36.6k" "177" "2.2" "41.1k"
[81] "240" "186k" "67.4k" "18.9k" "3800" "19.5k" "1.01M" "680k" "6480" "96k"
[91] "8190" "328" "1530" "85k" "5280" "975" "249k" "31.4k" "38.9k" "11.9k"
[101] "107k" "11.8" "110" "64.6k" "51.3" "173k" "1380" "81.6k" "2170" "210"
[111] "67" "21.5k" "345" "20.5k" "871" "32.7k" "10" "55.4k" "0" "3500"
[121] "129k" "8.2" "681k" "94" "9580" "133k" "3.5" "342k" "6260" "142k"
[131] "316" "407k" "4110" "412" "30k" "195k" "79.2k" "8380" "13k" "246k"
[141] "51.6k" "3620" "" "121k" "58.2k" "0" "98.5k" "30" "44.3k" "44.2k"
[151] "750k" "72.2k" "398" "363k" "91.1k" "4420" "64.1k" "32.8k" "223k" "91.2"
[161] "1490" "0" "64k" "8.1M" "2830" "9770" "" "87.8k" "172" "25.4k"
[171] "28.9k" "6650" "10" "73.6k" "24.8k" "" "583" "153k" "19k" "12.4k"
[181] "281k" "4760" "" "337" "4440" "105" "61.9k" "12.6k" "192k" "4100"
[191] "41.3k" "9460" "89.5" "2360" "6720" "203k" "10" "529k" "30.8k" "95.2k"
[201] "14.4k" "3.05M" "30.4k" "285" "488k" "36.6" "201" "121k" "4420" "1700"
[211] "5490" "177k" "470k" "183k"
gp[c(1,3), 2:5]
gp[ which(gp$X1989 <= 100 & gp$X2019 >= 100),]
n <- 10
if (n < 10) {
print("n is less than 10")
} else if (n > 10) {
print("n is greater than 10")
} else {
print("n is equal to 10")
}
[1] "n is equal to 10"
for (n in seq(0,20)) {
if (n < 10) {
print("n is less than 10")
} else if (n > 10) {
print("n is greater than 10")
} else {
print("n is equal to 10")
}
}
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is less than 10"
[1] "n is equal to 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
[1] "n is greater than 10"
g <- 0
while (g <=10) {
print(paste(g,"is less than or equal to 10"))
g <- g+1
}
[1] "0 is less than or equal to 10"
[1] "1 is less than or equal to 10"
[1] "2 is less than or equal to 10"
[1] "3 is less than or equal to 10"
[1] "4 is less than or equal to 10"
[1] "5 is less than or equal to 10"
[1] "6 is less than or equal to 10"
[1] "7 is less than or equal to 10"
[1] "8 is less than or equal to 10"
[1] "9 is less than or equal to 10"
[1] "10 is less than or equal to 10"
install.packages("ggplot2")
also installing the dependencies ‘cli’, ‘colorspace’, ‘utf8’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘RColorBrewer’, ‘viridisLite’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘gtable’, ‘isoband’, ‘scales’, ‘tibble’, ‘withr’
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/cli_3.4.1.tgz'
Content type 'application/x-gzip' length 1284000 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/colorspace_2.0-3.tgz'
Content type 'application/x-gzip' length 2624460 bytes (2.5 MB)
==================================================
downloaded 2.5 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/utf8_1.2.2.tgz'
Content type 'application/x-gzip' length 196851 bytes (192 KB)
==================================================
downloaded 192 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/farver_2.1.1.tgz'
Content type 'application/x-gzip' length 1943238 bytes (1.9 MB)
==================================================
downloaded 1.9 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/labeling_0.4.2.tgz'
Content type 'application/x-gzip' length 60389 bytes (58 KB)
==================================================
downloaded 58 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/lifecycle_1.0.3.tgz'
Content type 'application/x-gzip' length 121220 bytes (118 KB)
==================================================
downloaded 118 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/munsell_0.5.0.tgz'
Content type 'application/x-gzip' length 241895 bytes (236 KB)
==================================================
downloaded 236 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/RColorBrewer_1.1-3.tgz'
Content type 'application/x-gzip' length 53152 bytes (51 KB)
==================================================
downloaded 51 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/viridisLite_0.4.1.tgz'
Content type 'application/x-gzip' length 1297022 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/fansi_1.0.3.tgz'
Content type 'application/x-gzip' length 363921 bytes (355 KB)
==================================================
downloaded 355 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/pillar_1.8.1.tgz'
Content type 'application/x-gzip' length 673948 bytes (658 KB)
==================================================
downloaded 658 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/pkgconfig_2.0.3.tgz'
Content type 'application/x-gzip' length 17870 bytes (17 KB)
==================================================
downloaded 17 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/vctrs_0.4.2.tgz'
Content type 'application/x-gzip' length 1723901 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/gtable_0.3.1.tgz'
Content type 'application/x-gzip' length 158928 bytes (155 KB)
==================================================
downloaded 155 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/isoband_0.2.6.tgz'
Content type 'application/x-gzip' length 3386455 bytes (3.2 MB)
==================================================
downloaded 3.2 MB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/scales_1.2.1.tgz'
Content type 'application/x-gzip' length 608312 bytes (594 KB)
==================================================
downloaded 594 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/tibble_3.1.8.tgz'
Content type 'application/x-gzip' length 720020 bytes (703 KB)
==================================================
downloaded 703 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/withr_2.5.0.tgz'
Content type 'application/x-gzip' length 229317 bytes (223 KB)
==================================================
downloaded 223 KB
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/ggplot2_3.3.6.tgz'
Content type 'application/x-gzip' length 4125157 bytes (3.9 MB)
==================================================
downloaded 3.9 MB
The downloaded binary packages are in
/var/folders/_0/6sf9j_5d6gs3m4rcg_7lqy1r0000gn/T//RtmpZ5guiU/downloaded_packages
library(ggplot2)
forestdata <- read.csv('forest_area_sq_km.csv')
head(forestdata)
ggplot(data=forestdata, mapping=aes(x=X1989, y=X2019)) + geom_point()
gp <- read.csv('gapminder_all.csv')
gp
ggplot(data=gp, mapping=aes(x=gdpPercap_1952, y=pop_1952)) + geom_point()
ggplot(data=gp, mapping=aes(x=gdpPercap_2002, y=pop_2002)) + geom_point()
gapminder <- read.csv("https://raw.githubusercontent.com/swcarpentry/r-novice-gapminder/gh-pages/_episodes_rmd/data/gapminder_data.csv")
head(gapminder)
ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp)) + geom_point()
ggplot(data=gapminder, mapping=aes(x=year, y=lifeExp, by=country, color=continent)) + geom_line()
ggplot(data=gapminder, mapping=aes(x=year, y=lifeExp, by=country)) + geom_line(mapping = aes(color=continent)) + geom_point()
ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp)) + geom_point()
ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp)) + geom_point(alpha=0.25) + scale_x_log10()
ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp)) + geom_point(alpha=0.25, color="purple", size = 0.9, pch = 9) + scale_x_log10() + geom_smooth(method=lm, color="gold", size=1.25)
africas <- gapminder[gapminder$continent == "Africa", ]
head(africas)
ggplot(data=africas, mapping = aes(x=year, y=lifeExp)) +
geom_line(color = 'blue') +
facet_wrap( ~ country) +
theme(axis.text.x = element_text(angle = 90)) +
labs(
x = "year",
y = "life Expentency",
title = "Life Expectency Over Time in African Countries"
)
AfricanLifeExp <- ggplot(data=africas, mapping = aes(x=year, y=lifeExp)) +
geom_line(color = 'blue') +
facet_wrap( ~ country) +
theme(axis.text.x = element_text(angle = 90)) +
labs(
x = "year",
y = "life Expentency",
title = "Life Expectency Over Time in African Countries"
)
ggsave(filename = "AfricanLifeExp.png", plot = AfricanLifeExp, width = 24, height = 40, dpi = 300, units = "cm")
pdf(file = "AfricanLifeExp.pdf", width = 24, height = 40)
plot(AfricanLifeExp)
dev.off()
null device
1
write.table(gapminder, file="gapminder_web.csv", sep = ",")
write.csv(africas, file="gapminder_web_africas.csv")